package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Xqjsfxov type
*/
@SuppressWarnings("ALL")
public class Xqjsfxov {


        private static volatile Xqjsfxov instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Xqjsfxov getInstance() {
            if (instance == null) {
                synchronized (Xqjsfxov.class) {
                    if (instance == null) {
                        instance = new Xqjsfxov();
                    }
                }
            }
            return instance;
        }


        private Xqjsfxov() {

        }



    public  Boolean judgeKkrzipgubn(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeLjtmbtpedx(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeAojavygrbg(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeVcmnbmgsjz(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeHvxnuqwvoq(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeQbtovolidc(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeJxxxjkgmfn(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  kkrzipgubn;
    private String  ljtmbtpedx;
    private String  aojavygrbg;
    private String  vcmnbmgsjz;
    private String  hvxnuqwvoq;
    private String  qbtovolidc;
    private String  jxxxjkgmfn;


    public void setKkrzipgubn(String kkrzipgubn){
    this.kkrzipgubn = kkrzipgubn;
    }

    public String getKkrzipgubn(){
    return this.kkrzipgubn;
    }
    public void setLjtmbtpedx(String ljtmbtpedx){
    this.ljtmbtpedx = ljtmbtpedx;
    }

    public String getLjtmbtpedx(){
    return this.ljtmbtpedx;
    }
    public void setAojavygrbg(String aojavygrbg){
    this.aojavygrbg = aojavygrbg;
    }

    public String getAojavygrbg(){
    return this.aojavygrbg;
    }
    public void setVcmnbmgsjz(String vcmnbmgsjz){
    this.vcmnbmgsjz = vcmnbmgsjz;
    }

    public String getVcmnbmgsjz(){
    return this.vcmnbmgsjz;
    }
    public void setHvxnuqwvoq(String hvxnuqwvoq){
    this.hvxnuqwvoq = hvxnuqwvoq;
    }

    public String getHvxnuqwvoq(){
    return this.hvxnuqwvoq;
    }
    public void setQbtovolidc(String qbtovolidc){
    this.qbtovolidc = qbtovolidc;
    }

    public String getQbtovolidc(){
    return this.qbtovolidc;
    }
    public void setJxxxjkgmfn(String jxxxjkgmfn){
    this.jxxxjkgmfn = jxxxjkgmfn;
    }

    public String getJxxxjkgmfn(){
    return this.jxxxjkgmfn;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}